lm integration: Produce lm objects from Bayesian networks
Description
Take a bn object or bn.fit object encoding a Gaussian network
and refit all the local distributions using lm(). This makes it
possible to use all the functions provided by R for lm objects
(summary, anova, etc.) to investigate the network.
Usage
# S3 method for bn
as.lm(x, data, ...)
# S3 method for bn.fit
as.lm(x, data, ...)
# S3 method for bn.fit.gnode
as.lm(x, data, ...)
Arguments
x
an object of class bn, bn.fit or bn.fit.gnode.
data
a data frame containing the variables in the model.
…
additional arguments, currently ignored.
Value
If x is an object of class bn or bn.fit, as.lm()
returns a list of lm objects, one for each node in x. If
x is an object of class bn or bn.fit.gnode,
as.lm() returns a single lm object.